from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_age()
    page.goto('http://whatsmyuseragent.org/')
    page.screenshot(path='example.png')
    browser.close()


